<?php
namespace Admin\Model;
use Think\Model\RelationModel;

class ReturnGoodModel extends RelationModel{
    protected $_link = array(
        //订单表
        'order'=>array(
            'mapping_type' => self::BELONGS_TO,
            'class_name' => 'Order',
            'foreign_key' => 'order_id',
            'mapping_fields' => 'order_id,id',
            //'as_fields' => 'order_id'
        ),
        //图片表
        'images'=>array(
            'mapping_type' => self::HAS_MANY,
            'class_name' => 'ReturnGoodImages',
            'foreign_key' => 'return_good_id',
            'mapping_fields' => 'url,id',
            'as_fields' => 'url,id'
        ),
        //代理表
        'agent'=>array(
            'mapping_type' => self::BELONGS_TO,
            'class_name' => 'Agent',
            'foreign_key' => 'agent_id',
            'mapping_fields' => 'agent_name',
            'as_fields' => 'agent_name'
        ),


    );
}